package com.gt.entity.base;
import java.io.Serializable;

/**
 * 数据消息实体类
 * @author Assassin
 */
public class DataMessage implements Serializable {
	
	/**
	 * default SerialVersionUID
	 */
	private static final long serialVersionUID = 1L;
	
	// Fields
	
	private int result;// 操作结果[0-成功 | -1-失败 | -2-参数错误 | -3 非法请求 | -4-系统异常]
	private Object data;// 数据对象
	private String message;// 消息内容
	
	// Empty Constructor
	public DataMessage() {
		super();
	}

	// Full Constructor
	public DataMessage(int result, Object data, String message) {
		super();
		this.result = result;
		this.data = data;
		this.message = message;
	}

	// Property accessors
	
	public int getResult() {
		return result;
	}

	public void setResult(int result) {
		this.clearData();
		this.result = result;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
	
	/**
	 * 清空上一次数据结果
	 */
	public void clearData() {
		this.setMessage(null);
		this.setData(null);
	}
	
}